package pkg

import (
	"fmt"
	"net"

	"github.com/urfave/cli"
)

func Ip() cli.Command {
	return cli.Command{
		Name:  "ip",
		Usage: "Looks up the IP addresses for a particular host",
		Action: func(c *cli.Context) error {
			ip, err := net.LookupIP(c.Args().Get(0))
			if err != nil {
				return err
			}
			for _, ipv := range ip {
				fmt.Printf("ip: %s\n", ipv)
			}
			return nil
		},
	}
}
